package xyz.xmh.pojo.request.file;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import lombok.Data;
import xyz.xmh.autoconfigure.TokenStatic;
import xyz.xmh.pojo.enums.CheckNameEnum;
import xyz.xmh.pojo.response.file.CreateFileResponse;
import xyz.xmh.pojo.response.file.CreateFolderResponse;

/**
 * 2021/10/18 3:30 星期一<br/>
 * 创建文件夹请求参数
 *
 * @author xuMingHai
 */
@Data
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true)
@JsonSubTypes(value = {
        @JsonSubTypes.Type(value = CreateFileResponse.class, name = "file"),
        @JsonSubTypes.Type(value = CreateFolderResponse.class, name = "folder")
})
public class CreateFolderRequest {

    /**
     * 类型是文件夹
     */
    private final String type = "folder";
    /**
     * 同名处理模式，默认自动重命名
     */
    private String checkNameMode = CheckNameEnum.AUTO_RENAME.getValue();
    /**
     * 阿里云盘ID
     */
    private String driveId = TokenStatic.DEFAULT_DRIVE_ID;
    /**
     * 父目录ID，默认使用顶级目录
     */
    private String parentFileId = "root";
    /**
     * 文件名
     */
    private String name;

    public void setCheckNameMode(CheckNameEnum checkNameMode) {
        this.checkNameMode = checkNameMode.getValue();
    }
}
